﻿using System.Windows.Forms;

namespace QAToolsAddin.GenericDialogs.Fields {

    public class FieldCheckBox : Field, IField {
        readonly CheckBox _control;

        public FieldCheckBox(string name, string info, bool ischecked, bool retore = false)
            : base(name, info, retore) {
            _control = new CheckBox {
                Text = name,
                Checked = ischecked
            };
        }

        public override string Label {
            get { return string.Empty; }
        }

        public override Control Control {
            get { return _control; }
        }

        public bool Value {
            get { return _control.Checked; }
            set { _control.Checked = value; }
        }

        object IField.Value {
            get { return (object)Value; }
            set { Value = (bool)value; }
        }

        public override string ToDebugString() {
            return _control.Text + ": " + _control.Checked.ToString();
        }

    }

}
